/**
 * Created by ebalmes Oct 5, 2009 8:50:54 AM
 * 
 */
package model.types;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

public class MedEx implements Comparable<MedEx>, Serializable
{
  private int MedExId;
  
  private Date medExDate;
  
  private String description;

  public MedEx(Date medExDate, String description) {
    super();
    MedExId = (int)Calendar.getInstance().getTimeInMillis();
    this.medExDate = medExDate;
    this.description = description;
  }

  /**
   * @return the medExDate
   */
  public Date getMedExDate() {
    return medExDate;
  }

  /**
   * @param medExDate the medExDate to set
   */
  public void setMedExDate(Date medExDate) {
    this.medExDate = medExDate;
  }

  /**
   * @return the description
   */
  public String getDescription() {
    return description;
  }

  /**
   * @param description the description to set
   */
  public void setDescription(String description) {
    this.description = description;
  }

  /**
   * @return the medExId
   */
  public int getMedExId() {
    return MedExId;
  }

  /**
   * @see java.lang.Object#hashCode()
   */
  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + MedExId;
    result = prime * result + ((medExDate == null) ? 0 : medExDate.hashCode());
    return result;
  }

  /**
   * @see java.lang.Object#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (!(obj instanceof MedEx))
      return false;
    MedEx other = (MedEx) obj;
    if (MedExId != other.MedExId)
      return false;
    if (medExDate == null) {
      if (other.medExDate != null)
        return false;
    } else if (!medExDate.equals(other.medExDate))
      return false;
    return true;
  }

  @Override
  public int compareTo(MedEx o) {
    return medExDate.compareTo(o.getMedExDate());
  }
  
}
